<template>
  <div class="app-container">
    <el-table
      :key="tableKey"
      v-loading="listLoading"
      :data="list"
      border
      fit
      highlight-current-row
      style="width: 100%;"
      height="550"
    >
      <el-table-column label="规则" sortable="custom" align="center" width="180">
        <template slot-scope="{row}">
          <span>{{ row.name }}</span>
        </template>
      </el-table-column>

      <el-table-column label="规则说明" sortable="custom" align="center" width="180">
        <template slot-scope="{row}">
          <span>{{ row.description }}</span>
        </template>
      </el-table-column>

      <el-table-column label="操作" fixed="right" align="center" min-width="200" class-name="small-padding fixed-width" />
    </el-table>

  </div>
</template>

<script>
import {
  fetchRuleList
} from '@/api/rule'

export default {
  name: 'Rule',
  components: {},
  data() {
    return {
      tableKey: 0,
      list: [],
      total: 0,
      listLoading: true,
      submitLoading: false, // 提交中
      listQuery: {},
      rules: {}
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      fetchRuleList().then(res => {
        this.listLoading = false
        this.list = res.data.items
      }, rej => {
        this.listLoading = false
      })
    },
    jump(url) {
      this.$router.push(url)
    }
  }
}
</script>

<style>
  .el-dialog {
    width: 550px;
  }

  .cate-icon {
    width: 2.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .filter-container .filter-item {
    display: inline-block;
    vertical-align: middle;
  }
</style>
